﻿@using KPIS.GERP.Models.SYS;
@model IEnumerable<User>

@{
    ViewBag.Title = "จัดการผู้ใช้งาน";
}

@{
	var mod = Model ?? new List<User>();
}
<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table border="1">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Employee.Position.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Code)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Password)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Employee.FullName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.RecordStatus)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CreatedBy)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CreatedWhen)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.UpdatedBy)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.UpdatedWhen)
        </th>
        <th>&nbsp;</th>
    </tr>

@foreach (var item in mod)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Employee.Position.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Code)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Password)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Employee.FullName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.RecordStatus)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CreatedBy)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CreatedWhen)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.UpdatedBy)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.UpdatedWhen)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.UserId }) |
            @Html.ActionLink("Details", "Details", new { id=item.UserId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.UserId })
        </td>
    </tr>
}

</table>
